# 和最大
N, M = map(int, input().split())
lt = []
for i in range(N):
    nums = list(map(int, input().split()))
    lt.append(nums)
print(lt)
lt2=[]
for i in lt:
    lt2.append(max(i))
print(sum(lt2))


